var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var r = t("GameConstant"),
s = t("GameLogic"),
l = t("Util"),
c = t("WeaponControl"),
d = cc._decorator,
h = d.ccclass,
p = (d.property,
function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e._gameLogic = new s.GameLogic,
        e._weaponControl = null,
        e.isGameOver = !1,
        e.nCarTag = 0,
        e.bSawCollision = !1,
        e.bElecSawCollision = !1,
        e.curSawDate = 0,
        e.curElecSawDate = 0,
        e.bSceneRightSaw = !1,
        e.bSceneLeftSaw = !1,
        e.isHammerDamage = !1,
        e.isdoubleSawDamage = !1,
        e.isSawDamage = !1,
        e.isElecSawDamage = !1,
        e
    }
    return n(e, t),
    e.prototype.init = function(t, e, o) {
        o ? (this.node.active = !0, this._weaponControl = t, this.nCarTag = e, this.isGameOver = !1, this.node.getComponent(cc.Collider).tag = this._gameLogic.getCollideTag(e, r.Collide_Weapon_Tag.wheel)) : this.node.active = !1
    },
    e.prototype.onGameStart = function() {
        this.isGameOver = !1
    },
    e.prototype.onGameOver = function() {
        this.isGameOver = !0
    },
    e.prototype.onGameBoutReady = function() {
        this.node.active = !1
    },
    e.prototype.onGameBoutStart = function() {
        this.isGameOver = !1
    },
    e.prototype.onGameBoutOver = function() {
        this.isGameOver = !0
    },
    e.prototype.onAirShipIn = function() {
        this.node.active = !1
    },
    e.prototype.onAirShipOut = function() {
        this.node.active = !0
    },
    e.prototype.onCollisionEnter = function(t, e) {
        if (!this.isGameOver) {
            var o = this._gameLogic.getColliderCarTag(e.tag);
            if (t.node.group === r.Collide_Group_Blade) {
                if (o == this.nCarTag && o == this.nCarTag) return void(t.tag == r.Collide_Weapon_Tag.SceneRight_Saw ? this.damageRightSawHp() : t.tag == r.Collide_Weapon_Tag.SceneLeft_Saw && this.damageLefSawHp())
            } else t.node.group == r.Collide_Group_Car.wheel && o == this.nCarTag && this.onCollideCarWheel("wheelWheel", !0, !1);
            var i = this._gameLogic.getColliderCarTag(t.tag),
            n = t.world.position;
            if (i != o && o == this.nCarTag) switch (this._gameLogic.getColliderWeaponTag(t.tag)) {
                case r.Collide_Weapon_Tag.Hammer:
                    this.damageHammerHp(n),
                l.Util.respownStarParticle(n);
                break;
                case r.Collide_Weapon_Tag.Saw:
                    this.damageSawHp(),
                this.bSawCollision = !0,
                this.curSawDate = 0;
                break;
                case r.Collide_Weapon_Tag.Rocket:
                    this.damageRocketHp(t);
                break;
                case r.Collide_Weapon_Tag.ElecSaw:
                    this.damageElecSawHp();
                break;
                case r.Collide_Weapon_Tag.Fist:
                    l.Util.respownStarParticle(n),
                this.damageFistHp();
                break;
                case r.Collide_Weapon_Tag.DoubleSaw:
                    this.damageDoubleSawHp(n),
                l.Util.respownStarParticle(n);
                break;
                case r.Collide_Weapon_Tag.Gatlin:
                    this.damageGatlinHp(t);
                break;
                case r.Collide_Weapon_Tag.Grenade:
                    this.damageGrenadeHp(t);
                break;
                case r.Collide_Weapon_Tag.Laser:
                    this.damageLaserHp(t);
                break;
                case r.Collide_Weapon_Tag.shotgun:
                    this.damageShotgunHp(t);
                break;
                case r.Collide_Weapon_Tag.boomerang:
                    this.damageBoomerangHp(t);
            }
        }
    },
    e.prototype.onCollisionStay = function() {
        this.isGameOver
    },
    e.prototype.onCollisionExit = function(t, e) {
        if (!this.isGameOver) {
            var o = this._gameLogic.getColliderCarTag(t.tag),
            i = this._gameLogic.getColliderCarTag(e.tag);
            if (t.node.group === r.Collide_Group_Blade) {
                if (i == this.nCarTag) return i == this.nCarTag ? void(t.tag == r.Collide_Weapon_Tag.SceneRight_Saw ? this.bSceneRightSaw = !1 : t.tag == r.Collide_Weapon_Tag.SceneLeft_Saw && (this.bSceneLeftSaw = !1)) : void 0
            } else t.node.group == r.Collide_Group_Car.wheel && i == this.nCarTag && this && this.onCollideCarWheel("wheelWheel", !1, !0);
            if (o != i && i == this.nCarTag) switch (this._gameLogic.getColliderWeaponTag(t.tag)) {
                case r.Collide_Weapon_Tag.Hammer:
                    this.isHammerDamage = !1;
                break;
                case r.Collide_Weapon_Tag.Saw:
                    this.isSawDamage = !1,
                this.bSawCollision = !1,
                this.curSawDate = 0,
                this.sawLeaveCar(o, r.Collide_Weapon_Tag.Saw);
                break;
                case r.Collide_Weapon_Tag.Rocket:
                    break;
                case r.Collide_Weapon_Tag.ElecSaw:
                    this.isElecSawDamage = !1,
                this.bElecSawCollision = !1,
                this.curElecSawDate = 0;
                break;
                case r.Collide_Weapon_Tag.Fist:
                    break;
                case r.Collide_Weapon_Tag.DoubleSaw:
                    this.isdoubleSawDamage = !1;
            }
        }
    },
    e.prototype.damageRightSawHp = function() {
        this._weaponControl.damageRightSawHp(!1),
        this.bSceneRightSaw = !0
    },
    e.prototype.damageLefSawHp = function() {
        this._weaponControl.damageLefSawHp(!1),
        this.bSceneLeftSaw = !0
    },
    e.prototype.damageHammerHp = function(t) {
        this._weaponControl.damageHammerHp(t),
        this.isHammerDamage = !0
    },
    e.prototype.mineBlowOff = function(t) {
        this._weaponControl.mineBlowOff(t)
    },
    e.prototype.damageDoubleSawHp = function(t) {
        this._weaponControl.damageDoubleSawHp(t),
        this.isdoubleSawDamage = !0
    },
    e.prototype.damageSawHp = function() {
        this._weaponControl.damageSawHp(!1),
        this.isSawDamage = !0
    },
    e.prototype.damageElecSawHp = function() {
        this._weaponControl.damageElecSawHp(!1),
        this.isElecSawDamage = !0
    },
    e.prototype.sawLeaveCar = function(t, e) {
        this._weaponControl.sawLeaveCar(t, e)
    },
    e.prototype.damageRocketHp = function(t) {
        this._weaponControl && this._weaponControl.damageRocketHp(t)
    },
    e.prototype.damageGatlinHp = function(t) {
        this._weaponControl && this._weaponControl.damageGatlinHp(t)
    },
    e.prototype.damageGrenadeHp = function(t) {
        this._weaponControl && this._weaponControl.damageGrenadeHp(t)
    },
    e.prototype.damageShotgunHp = function(t) {
        this._weaponControl && this._weaponControl.damageShotgunHp(t)
    },
    e.prototype.damageLaserHp = function(t) {
        this._weaponControl && this._weaponControl.damageLaserHp(t)
    },
    e.prototype.damageBoomerangHp = function(t) {
        this._weaponControl && this._weaponControl.damageBoomerangHp(t)
    },
    e.prototype.damageFistHp = function() {
        this._weaponControl.damageFistHp()
    },
    e.prototype.onCollideCarWheel = function(t, e, o) {
        this._weaponControl && this._weaponControl.onCollideCarWheel(t, e, o)
    },
    a([h], e)
} (c.default));
o.default = p